package main

import (
	"fmt"
	"net"
)

func main() {

	conn, err := net.Dial("tcp", net.JoinHostPort("127.0.0.1", "8888"))
	if err != nil {
		return
	}
	defer conn.Close()
	sendMsg := make([]byte, 1024)
	for {
		fmt.Printf("请输入发送内容")
		conn.Write(sendMsg)
		n, err2 := conn.Read(sendMsg)
		if err2 != nil {
			return
		}
		result := sendMsg[:n]
		fmt.Printf("接收到数据%s\n", result)
	}

}
